[ASP.NET] A CustomValidator doesn't need to have it's ControlToValidate property set, so...

Posted by pkiyan on Stack Overflow See other posts from Stack Overflow or by pkiyan
Published on 2010-06-08T20:06:32Z Indexed on 2010/06/08 20:32 UTC
Read the original article Hit count: 291

Hi:

I've just finished reading up on the CustomValidator control and I have a question. In the book I'm reading, it says that a CustomValidator doesn't need to have it's ControlToValidate property set and it gives a few examples of that usage. But in one example where ControlToValidate isn't used, the OnServerValidate function has a timer (5 seconds) that you need to beat by entering your 'answer' into a textbox. If it takes you longer than 5 seconds, the CustomValidator's error message pops up next to the textbox (it's like a timed question/answer game) . How did the CustomValidator know to place the message next to the textbox (there's no association between the two, that I know of)? I wanted to test this, so I put a couple more textboxes on the page and the error message always showed up next to the last textbox I placed on the page. Thanks.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about validation